package edu.pku.sei.transformation.editor.views.icons;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;

public class IconsProvider {
	private static final Map stringToImage = new HashMap();
	//connection
	public static final String CONNECTION_ICO = "connection.ico";
	public static final String CONNECTION_DASH_ICO = "connection_dash.ico";
	
	//composition control node
	public static final String CONTROL_INIT_ICO = "control_init.ico";
	public static final String CONTROL_FINAL_ICO = "control_final.ico";
	public static final String CONTROL_DICISION_ICO = "control_dicision.ico";
	public static final String CONTROL_JOIN_ICO = "control_join.ico";
	public static final String CONTROL_FORK_ICO = "control_fork.ico";
	public static final String CONTROL_MERGE_ICO = "control_merge.ico";
	
	//area
	public static final String AREA_DIAGRAM_ICO = "area_diagram.ico";
	public static final String AREA_TEXT_ICO = "area_text.ico";
	
	//other
	public static final String DOUBLE_ARROW_ICO = "double_arrow.ico";
	
	public static final String EXECUTION_ICO = "execution.ico";
	public static final String EXPRESSION_ICO = "expression.ico";
	public static final String KEY_ICO = "key.ico";
	public static final String MODEL_ICO = "model.ico";
	public static final String NODE_ICO = "node.ico";
	public static final String RULE_ICO = "rule.ico";
	public static final String TEST_ICO = "test.ico";
	public static final String TRANSFORMATION_ICO = "transformation.ico";
	public static final String TREE_ICO = "tree.ico";
	public static final String GOAL_ICO = "goal.ico";
	public static final String CHECKPOINT_ICO= "checkpoint.ico";
	public static final String EXECUTION2_ICO="execution2.ico";
	public static final String TEST2_ICO = "test2.ico";
	//file
	public static final String FILE_ICO = "file.ico";
	public static final String FILE_IMPORT_ICO = "file_import.ico";
	public static final String FILE_EXPORT_ICO = "file_export.ico";
	
	//line
	public static final String LINE_ICO = "line.ico";
	public static final String LINE_ARROW_ICO = "line_arrow.ico";
	public static final String LINE_DASH_ICO = "line_dash.ico";
	public static final String LINE_DASH_ARROW_ICO = "line_dash_arrow.ico";
	public static final String LINE_DIAMOND_ICO = "line_diamond.ico";
	public static final String LINE_SOLID_DIAMOND_ICO = "line_solid_diamond.ico";
	public static final String LINE_TRIANGLE_ICO = "line_triangle.ico";
	
	//state
	public static final String STATE_SUCCESS_ICO = "state_success.ico";
	public static final String STATE_FAIL_ICO = "state_fail.ico";
	
	public static final String PIN_ICO = "pin.ico";
	
	public static final String ADD_ICO = "add.ico";
	public static final String REMOVE_ICO = "remove.ico";
	
	
	public static Image getImage(String key) {
		Image img = (Image) stringToImage.get(key);
		if (img == null) {
			img = (Image) getImageDescriptor(key).createResource(Display.getCurrent());
			stringToImage.put(key, img);
		}
		return img;
	}

	public static ImageDescriptor getImageDescriptor(String key) {
		return ImageDescriptor.createFromFile(IconsProvider.class, key);
	}
}
